//
//  KWMSettingDao.m
//  IWant_User
//
//  Created by kevin on 1/4/15.
//  Copyright (c) 2015 kollway. All rights reserved.
//

#import "KWMSettingDao.h"

@implementation KWMSettingDao{
}

+(KWMSettingDao *) shareDao{
    static KWMSettingDao *dao = nil;
    static dispatch_once_t oncePredicate;
    dispatch_once(&oncePredicate,^{
        dao = [[self alloc] init];
    });
    
    return dao;
}

+(NSString *) shareModel{
    static NSString *model = nil;model = nil;
    #ifdef IWant_User
        model = @"User";
    #else
        model = @"Merchants";
    #endif
    return model;
}

//设置是否接收新消息
-(void)setReceiveMsg:(BOOL)receiveMsg{
    
    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
    [defaults setBool:receiveMsg forKey:[NSString stringWithFormat:@"%@%@",[KWMSettingDao shareModel],@"receiverMsg"]];
    [defaults synchronize];
}
//是否接收新消息
-(BOOL)receiveMsg{
    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
    BOOL isReceiveMsg = [defaults boolForKey:[NSString stringWithFormat:@"%@%@",[KWMSettingDao shareModel],@"receiverMsg"]];
    return isReceiveMsg;
}


//设置是否震动
-(void)setIsShake:(BOOL)isShake{
    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
    [defaults setBool:isShake forKey:[NSString stringWithFormat:@"%@%@",[KWMSettingDao shareModel],@"MsgShake"]];
    [defaults synchronize];
}


//是否震动
-(BOOL)isShake{
    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
    BOOL isShake = [defaults boolForKey:[NSString stringWithFormat:@"%@%@",[KWMSettingDao shareModel],@"MsgShake"]];
    return isShake;
}

//设置是否有声音
-(void)setIsVoice:(BOOL)isVoice{
    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
    [defaults setBool:isVoice forKey:[NSString stringWithFormat:@"%@%@",[KWMSettingDao shareModel],@"MsgVoice"]];
    [defaults synchronize];
}

//是否有声音
-(BOOL)isVoice{
    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
    BOOL isVoice = [defaults boolForKey:[NSString stringWithFormat:@"%@%@",[KWMSettingDao shareModel],@"MsgVoice"]];
    return isVoice;
}

@end
